package com.zsc.spring.study.applicationEvent;

import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 *  实现Spring事件监听有两种方式：
 *         + 面向接口编程，实现ApplicationListener接口；
 *         + 基于注解驱动，@EventListener(Spring自定义的注解)
 */
@Component
public class BlackListNotifier  //implements ApplicationListener<MyApplicationEvent>
 {

    private String notificationAddress;

    public void setNotificationAddress(String notificationAddress) {
        this.notificationAddress = notificationAddress;
    }

    @EventListener//ע��
    public void onApplicationEvent(MyApplicationEvent event) {
        System.out.println("������MyApplicationEvent��"+event);
    }
}
